package xyz.yuzegod.megawalls.game.stage;

import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
import xyz.yuzegod.megawalls.MegaWalls;
import xyz.yuzegod.megawalls.game.Game;
import xyz.yuzegod.megawalls.timer.CenterCheckTimer;

public class DeathMatchStage extends GameStage
{
    public DeathMatchStage() {
        super("死斗模式", 10, 10, 99);
    }
    
    @Override
    public void excute(final Game game) {
        game.setDeathMatch(true);
        game.getStageManager().setCurrentStage(3);
        game.getStageManager().setSeconds(((BattleStage)game.getStageManager().getStage(3)).getCacheLeft() + 10);
        Bukkit.getScheduler().runTaskTimer((Plugin)MegaWalls.getInstance(), (Runnable)new CenterCheckTimer(game), 0L, 100L);
    }
    
    @Override
    public void excuteLeftSeconds(final Game game, final int left) {
        if (left <= 5) {
            game.broadcastMessage("§c§l所有的凋零已经死亡！还有§b§l" + left + "§c§l秒开启死斗模式！");
        }
    }
}
